package com.tz.online.entity;

import java.util.Date;
import java.util.Set;

public class Order {
	private Long orderId; // 订单ID标识
	private String orderNum; // 订单标号
	private Date createDate; // 下单日期
	private Set<OrderItem> items; // 订单中的商品明细
	private User user; // 订单所属用户
	private Address address; // 订单的发货地址
	private String orderStatus; // 订单状态 0：未付款 1：已付款

	public Long getOrderId() {
		return orderId;
	}

	public void setOrderId(Long orderId) {
		this.orderId = orderId;
	}

	public String getOrderNum() {
		return orderNum;
	}

	public void setOrderNum(String orderNum) {
		this.orderNum = orderNum;
	}

	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	public Set<OrderItem> getItems() {
		return items;
	}

	public void setItems(Set<OrderItem> items) {
		for (OrderItem oi : items) {
			oi.setOrder(this);
		}
		this.items = items;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public Address getAddress() {
		return address;
	}

	public void setAddress(Address address) {
		this.address = address;
	}

	public String getOrderStatus() {
		return orderStatus;
	}

	public void setOrderStatus(String orderStatus) {
		this.orderStatus = orderStatus;
	}

	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("Order [orderId=");
		builder.append(orderId);
		builder.append(", orderNum=");
		builder.append(orderNum);
		builder.append(", createDate=");
		builder.append(createDate);
		builder.append(", user=");
		builder.append(user);
		builder.append(", address=");
		builder.append(address);
		builder.append(", orderStatus=");
		builder.append(orderStatus);
		builder.append("]");
		return builder.toString();
	}

}
